﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Gallio.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;

using jQuery.Validation.DataAnnotations;

namespace jQuery.Validation.Tests
{
    [TestFixture]
    public class CreditCardAttributeTest
    {
        [Test]
        [Row("446 667 651")]
        [Row("446-667-651")]
        [Row("446667651")]
        [Row(446667651)]
        public void IsValidForCorrectStrings(string value)
        {
            CreditCardAttribute attr = new CreditCardAttribute();
            Assert.IsTrue(attr.IsValid(value));
        }

        [Test]
        public void IsValidForNullValue()
        {
            CreditCardAttribute attr = new CreditCardAttribute();
            Assert.IsTrue(attr.IsValid(null));
        }

        [Test]
        [Row("testString")]
        [Row("1111 1111 1111 1111")]
        [Row(1111111111111111)]
        public void IsNotValidForIncorrectStrings(string value)
        {
            CreditCardAttribute attr = new CreditCardAttribute();
            Assert.IsFalse(attr.IsValid(value));
        }

        [Test]
        public void IsNotValidForDateObjects()
        {
            CreditCardAttribute attr = new CreditCardAttribute();
            Assert.IsFalse(attr.IsValid(DateTime.Today));
        }
    }
}
